Skip to content

Conversation

linkmauve
Copy link
Contributor

As nothing actually depends on std, there is no need to keep a dependency on it. This allows users such as the jid crate to actually be no_std as well.

@linkmauve
Copy link
Contributor Author

Ah oops, that works in nightly but doesn’t yet in stable, due to core::error::Error not being exported yet… I could add a std feature that would be default and impl this trait, just like in jid, or just keep that PR open until that export gets stabilised, which option do you prefer?

@sfackler
Copy link
Owner

I think a std feature seems reasonable. If it becomes a no-op in the future once Error-in-core stabilizes that's fine.

@linkmauve
Copy link
Contributor Author

There, I have added an optional but enabled by default std feature.

@sfackler
Copy link
Owner

Can you also update the CI logic to also test with the std feature disabled?

LGTM otherwise

@linkmauve linkmauve force-pushed the no_std branch 2 times, most recently from 074d7bc to 92838fd Compare September 20, 2024 13:21
@linkmauve
Copy link
Contributor Author

Hi, sorry for the delay, but in the meantime core::error::Error got stabilized so I removed the std feature again. This now requires Rust 1.81.0, if this is too recent I can revert to the previous feature-based solution.

@sfackler
Copy link
Owner

I think it'd be safer to have an enabled-by-default std feature to avoid being blocked on adding future APIs that do require std. That'd also allow us today to continue to support older Rust versions by importing Error from std when enabled.

@linkmauve
Copy link
Contributor Author

linkmauve commented Sep 8, 2025

Hi, sorry for the very long delay, I’ve added back the std feature to support Rust versions older than 1.81.0, although nowadays that’s a bit old and most of the ecosystem won’t build on such ancient versions any longer.

I’ve added a test in CI for no_std on Rust 1.81.0, and a test with the std feature on Rust 1.56.0 so that we know there is no regression anywhere.

@linkmauve linkmauve force-pushed the no_std branch 5 times, most recently from 52f5cfc to 8d6d2d1 Compare September 8, 2025 14:40
This allows users such as the jid crate to actually be no_std as well.

core::error::Error got stabilized back in Rust 1.81.0, but in order to
support older Rust versions we added a std feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants